package tech.aistar.controller.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import tech.aistar.entity.Picture;
import tech.aistar.entity.ServiceOrder;
import tech.aistar.service.demand.IPictureService;
import tech.aistar.service.order.IServiceOrderService;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * Created by 23827 on 2019/10/14.
 */
@Controller
@RequestMapping("/nav")
public class NavController {
    @Autowired
    private IServiceOrderService iServiceOrderService;
    @Autowired
    private IPictureService iPictureService;
    @RequestMapping("/list")
    public String nav(Model model, Integer userinfo_id, HttpSession session){
        Integer uid = (Integer) session.getAttribute("userinfo_id");

        List<ServiceOrder > serviceOrderList = iServiceOrderService.getById(uid);
//        model.addAttribute("serviceOrderList",serviceOrderList);
        session.setAttribute("serviceOrderList",serviceOrderList);

        Picture picture = iPictureService.findPathById(uid);
        session.setAttribute("picture",picture);
        return "common/nav";
    }
}
